class Solution(object):
    def canMeasureWater(self, x, y, z):
        """
        :type x: int
        :type y: int
        :type z: int
        :rtype: bool
        """
        def gcd(a,b):
            while b!=0:
                tmp = b
                b = a%b
                a = tmp
            return a
        if z>x+y:return False
        if x==z or y==z or x+y==z:return True
        return z%gcd(x,y)==0

print(Solution().canMeasureWater(2003,31037,1))
            
